import DS from 'ember-data';
import BaseModel from './base-model';
/*客户*/
export default BaseModel.extend({
    dateService: Ember.inject.service("date-service"),
    customer: DS.belongsTo('customer'), // 老人信息
    type:DS.belongsTo('dicttype'),////业务类型ID 参考c_tnb_recordViolationType
    setTime: DS.attr('string'),//规定时间
    exeTime: DS.attr('string'),//执行时间
    status: DS.attr('string'),//记录状态 1 提前，2未执行，3超时
    createTime: DS.attr('number'),//创建时间（前端用）
    callTime: DS.attr('number'),//呼叫时间（前端用）
    createDate: DS.attr('string'),//创建日期
    employee: DS.belongsTo('employee'), //执行人
    nursingPlanDetail: DS.belongsTo('nursingplandetail'), //护理项目
    customerDrugProject: DS.belongsTo('customerdrugproject'), //用药计划
    // hbeaconWarning: DS.belongsTo('hbeaconwarning'), //呼叫
    remark:DS.attr('string'),
    exeTimeString: Ember.computed("exeTime", function() {
        var exeTime = this.get("exeTime");
        return exeTime ? this.get("dateService").formatDate(exeTime, "yyyy-MM-dd hh:mm") : '——';
    }),
    createTimeString: Ember.computed("createTime", function() {
        var createTime = this.get("createTime");
        return createTime ? this.get("dateService").formatDate(createTime, "yyyy-MM-dd hh:mm") : '——';
    }),
    callTimeString: Ember.computed("callTime", function() {
        var callTime = this.get("callTime");
        return callTime ? this.get("dateService").formatDate(callTime, "yyyy-MM-dd hh:mm") : '——';
    }),
    statusString: Ember.computed("status", function() {
        var status = this.get("status");
        if(status == 1) {
          return "超前执行";
        } else if(status == 2) {
          return "未执行";
        } else {
          return "超时执行";
        }
    }),
});
